﻿' Copyright (C) 2011  Jan-Willem de Bruyn
'
'    This program is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.
'
'    This program is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.
'
'    You should have received a copy of the GNU General Public License
'    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Imports System.IO
Imports System.Xml
Imports System.Xml.Xsl
Public Class rssreader
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Dim rssfeed As String = TextBox1.Text
        Dim xslfile As String = Server.MapPath("layoutrss.xsl")
        Dim xmldoc As XmlDocument = New XmlDocument()
        xmldoc.Load(rssfeed)
        Dim xsldoc As XslCompiledTransform = New XslCompiledTransform()
        xsldoc.Load(xslfile)
        Dim strbuilder As StringBuilder = New StringBuilder()
        Dim strwriter As StringWriter = New StringWriter(strbuilder)
        xsldoc.Transform(xmldoc, Nothing, strwriter)
        strbuilder.Append(vbCrLf & "<p><em>Cached at: " & Now() & "</em></p>" & vbCrLf)
        Literal1.Text = strbuilder.ToString

    End Sub
End Class